<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.List" %>
<%@ page import="oneroom.admin.board.boardModel" %>
<jsp:useBean id="dao" scope="page" class="oneroom.admin.board.boardDao" />
<%@ page import="oneroom.admin.code.codeModel" %>
<jsp:useBean id="codeDao" scope="page" class="oneroom.admin.code.codeDao" />
<%
	String redirectUrl = "";
	if (session.getAttribute("id") != null &&
			((String)session.getAttribute("id")).equals("") == false) {
	} else {
		redirectUrl = "/room/member/login.jsp";
		response.sendRedirect(redirectUrl);
	}
	//기본 세트 값 시작
	String searchGubn = request.getParameter("searchGubn") == null ? "" : request.getParameter("searchGubn");
	String searchValue = request.getParameter("searchValue") == null ? "" : request.getParameter("searchValue");
	String searchBoard = request.getParameter("searchBoard") == null ? "" : request.getParameter("searchBoard");	
	int     giSelectPage  	= Integer.parseInt(request.getParameter("txtSelectPage") == null ? "0" :request.getParameter("txtSelectPage"));			//현재 선택된 페이지 저장
	int     giSelectBlock 	= Integer.parseInt(request.getParameter("txtSelectBlock") == null ? "0" :request.getParameter("txtSelectBlock"));			//현재 선택된 블락페이지 저장
	//기본 세트 값 끝

	String data_id = request.getParameter("data_id") == null ? "" : request.getParameter("data_id");
	boardModel model = dao.getView(data_id);
	List codeList = codeDao.getDtlList("200");//게시판 관리 코드 값
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>원룸몬스터</title>

<link href="/room/css/all.css" rel="stylesheet" type="text/css" />
<script src="/room/script/swfobject_modified.js" type="text/javascript"></script>
<script src="/room/script/common.js" type="text/javascript"></script>
<script src="/room/script/jquery-1.3.2.min.js" type="text/javascript" ></script>
<script type="text/javascript" src="/editor/editor.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
	
	$('#btList').click(function() {
		window.location.href="list.jsp?searchBoard=<%=searchBoard%>";
	});
});

function goWrite(){
	var frm = document.frm;
	frm.content.value = edit_frame.EditorCtrl.document.body.innerHTML;
	if(frm.title.value == ""){
		alert("제목을 입력 하십시요.");
		return false;
	}else if(frm.content.value == ""){
		alert("내용을 입력 하십시요.");
		return false;
	}else{
		//return true;
		frm.submit();
	}
}
//-->
</script>
</head>

<body>
<div align="center"> 

 <div id="content">

<!----------------왼쪽---------------->  
<%@ include file="/room/common/left.jsp" %>
<!----------------왼쪽끝---------------->  


<!----------------가운데 시작----------------> 
 <div id="rgt">
  <div id="con01">
   <div class="top bb1"><img src="/room/img/txt_top.gif" /></div>
   <div id="sch-adress"></div>
	<form action="dbx.jsp" name="frm" id="frm" method="post" enctype="multipart/form-data" >
	<input type="hidden" name="gubun" value="U" />
	<input type="hidden" name="data_id" value="<%=data_id %>"/>
	<input type="hidden" name="att_file" value="<%=model.getAtt_file()%>"/>
	<input type="hidden" name="org_file" value="<%=model.getOrg_file()%>"/>
	<input type="hidden" name="searchBoard" value="<%=searchBoard %>"/>	
	<input type="hidden" name="content" />	
<div class="list h550">
 <div class="pb10"><img src="/room/img/line_blue.gif" width="32" height="2" /></div>
       <div class="tit">게시판 </div>

<table width="595" border="0" cellspacing="0" cellpadding="0">
<col width="110" />
<col width="485" />
  <tr>
    <td class=" bt2 bb1 h30">
	<select name="board_kind" style="width:100px;" disabled='disabled'>
		<%
			for(int i = 0; i<codeList.size(); i++){
				codeModel mode = (codeModel)codeList.get(i);
		%>
		<option value="<%=mode.getCode() %>" <%if(searchBoard.equals(mode.getCode())){out.print(" selected='selected' ");} %>><%=mode.getCodename() %></option>
		<%
			}
		%>
	</select>  	   
    </td>
    <td class="bt2 bb1 h30 "><input style="width:98%;" name="title" value="<%=model.getTitle() %>" id="title" type="text" /></td>
    </tr>
    <tr>
    <td class="pl10  bb1 h30"><strong>첨부파일</strong> |</td>
    <td class=" bb1 h30">
	<input name="file_name" id="file_name"  type="file"  style="width:100%;" /><br />
	<a href="/download/<%=model.getAtt_file() %>?name=<%=model.getOrg_file() %>&kind=" ><%=model.getOrg_file() %></a> <input type="checkbox" name="delfile" value="Y"> 삭제
    </td>
    </tr>
    <tr>
    <td colspan="3" class=" pt10 pb10 bb1">
    <!--<textarea class="pt20 pl20 pb30 " style="width:96%; border:none" name="" cols="" rows="8"></textarea>-->
		<iframe width="600px" height="376" id="edit_frame" name="edit_frame" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" src="/editor/editor.htm"></iframe>
	<textarea rows="10" style="display:none;width:600px; height:300px;"  name="editorContents"><%=model.getContent()== null ? "" :model.getContent() %></textarea>    
    </td>
    </tr>
 </table>
<table class="pr15 pt10" align="right" width="115" border="0" cellspacing="0" cellpadding="0">
  <tr>
	<%if(model.getReg_id().equals((String)session.getAttribute("id"))){%>  
    <td> <a class="d" href="#" onclick="goWrite();"><p class="btn_b47">수정</p></a></td>
    <%} %>
    <td> <a class="d" href="#" id="btList"><p class="btn_g47">취소</p></a></td>
  </tr>
</table>
</div>
</form>
</div>  

<!----------------가운데 끝---------------->


<!----------------오른쪽 시작---------------->  
<%@ include file="/room/common/right.jsp" %>  
<!----------------오른쪽 끝---------------->
</div>


<!-------------푸터영역----------> 
<%@ include file="/room/common/footer.jsp" %> 
<!-------------푸터영역----------> 
<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>
</body>
</html>
